Skip to content

Retrieve relevant memories instead of dumping the full store - #17

Draft
ingoau wants to merge 1 commit into
masterfrom
cursor/efficient-memory-retrieval-707b
Draft

Retrieve relevant memories instead of dumping the full store#17
ingoau wants to merge 1 commit into
masterfrom
cursor/efficient-memory-retrieval-707b

Conversation

@ingoau

@ingoau ingoau commented Sep 8, 2026

Copy link
Copy Markdown
Member

The memory system was becoming expensive for a simple reason: every reply dumped the entire memory.json into the system prompt, and every list() re-read the file from disk. Combined with “err toward remembering,” token cost grew unbounded.

This change keeps the same on-disk JSON format and makes retrieval selective:

  • Cached store — load once (like channel modes), mutate in memory, persist on write.
  • Relevant subset in the prompt — rank by Slack user/channel IDs and keywords. Small stores still go in full. Larger stores get matching records plus a small recent fill, capped by MEMORY_CONTEXT_LIMIT (default 24). Prompt records are { id, content } only.
  • search_memory / delete_memory — look up omitted facts on demand, and prune obsolete or duplicate records.

Kevin is told when records were omitted so He can search instead of guessing.

Open in Web Open in Cursor 

Stop injecting every memory into each reply. Cache the JSON store in
memory, rank records by Slack ID and keywords, and expose search/delete
so the prompt stays bounded as memory grows.

Co-authored-by: Ingo Wolf <me@ingo.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants